﻿<%@ Page Title="POSSystem | Users" Theme="POSSystem" Language="C#" MasterPageFile="~/Application.Master" AutoEventWireup="true" CodeBehind="Users.aspx.cs" Inherits="WebUI.Users" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/Controls/SysControls/PageHeader.ascx" TagPrefix="uc" TagName="PageHeader" %>
<%@ Register Src="~/Controls/POSControls/UserListCtrl.ascx" TagName="UserList" TagPrefix="uc" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ApplicationHeadHolder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ApplicationContentHolder" runat="server">
    <script type="text/javascript">
        function onAddUser() {
            var id = getSelectedItemID<%=lstUsers.ClientID %>();
            var returnValue = window.showModalDialog('<%=GetUserEditPageLink() %>' + '&mode=new', '', 'dialogWidth=450px;dialogHeight=300px;resizable=no;help=no;unadorned=yes;');

            return returnValue > 0;
        }

        function onEditUser() {
            var id = getSelectedItemID<%=lstUsers.ClientID %>();
            if(id == null){
                alert("No item was selected!");
                return false;
            }
            var returnValue = window.showModalDialog('<%=GetUserEditPageLink() %>' + '&mode=edit&id=' + id, '', 'dialogWidth=450px;dialogHeight=300px;resizable=no;help=no;unadorned=yes;');
            return returnValue > 0;
        }

        function onRemoveUser() {
            return confirm('Are you sure to delete checked items?');
        }
    </script>
    <uc:PageHeader ID="pageHeader" Text="Users" ImageURL="~/Images/administrator-icon.png"
        runat="server" />
    <table width="100%">
        <tr>
            <td style="width: 100%; text-align: left; vertical-align: top">
                <asp:Panel ID="panel" runat="server" class="primaryPanel">
                    <div class="titleBar">
                        <asp:Label ID="lblTitle1" runat="server" CssClass="titleContent">User List</asp:Label>
                    </div>
                    <div class="primaryFrameNoBorder">
                        <asp:UpdatePanel ID="updateUser" runat="server">
                            <ContentTemplate>
                                <table width="100%" class="toolbar">
                                    <tr>
                                        <td style='vertical-align: middle'>
                                            <asp:LinkButton class="tbbutton" ID="btnAddUser" runat="server" OnClientClick="return onAddUser();"
                                                OnClick="btnAddUser_OnClick">
                                                <img src="Images/AddRecord.gif" /><asp:Label ID="label5" runat="server" Text="Add"></asp:Label>
                                            </asp:LinkButton>
                                            <asp:LinkButton class="tbbutton" ID="btnEditUser" runat="server" OnClientClick=" return onEditUser();"
                                                OnClick="btnAddUser_OnClick">
                                                <img src="Images/Edit.gif" /><asp:Label ID="label6" runat="server" Text="Edit"></asp:Label>
                                            </asp:LinkButton>
                                            <asp:LinkButton class="tbbutton" ID="btnDeleteUser" runat="server" OnClientClick="return onRemoveUser();"
                                                OnClick="btnRemoveUser_OnClick">
                                                <img src="Images/Delete.gif" /><asp:Label ID="label7" runat="server" Text="Delete"></asp:Label>
                                            </asp:LinkButton>
                                        </td>
                                    </tr>
                                </table>
                                <uc:UserList Width="100%" ID='lstUsers' runat="server" AllowPaging="true" AllowSelecting="true"
                                    AllowSorting="true" SaveOnCommit="false" />
                                
                                
                                <div style='height: 10px'>
                                    &nbsp;
                                </div>
                                <asp:Panel ID="panelErr" runat="server">
                                </asp:Panel>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                </asp:Panel>
            </td>
        </tr>
    </table>
</asp:Content>
